<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>修改密码</title>
</head>
<script src="/js/jquery/2.0.0/jquery.min.js"></script>
<link href="/css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="/js/bootstrap/3.3.6/bootstrap.min.js"></script>
<body>
<center>
    <style>
        div{
            margin:5px;
        }
    </style>
    <form action="/HTML/updatePasswordTo" method="post">
        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-account">账号</span>
            <input type="text" class="form-control"  name="user.account" th:placeholder="${user.account}" disabled>
        </div>

        <div class="input-group  col-md-3" >
            <span class="input-group-addon">原密码</span>
            <input type="text" class="form-control"   name="password" >
        </div>
        <div class="input-group  col-md-3" >
            <span class="input-group-addon" >新密码</span>
            <input type="password" class="form-control"   name="newPassword" id="pwd1" size="20">
        </div>
        <div class="input-group  col-md-3" >
            <span class="input-group-addon" >确认密码</span>
            <input type="password" class="form-control"   name="passwordD" id="pwd2" size="20" onkeyup="validate()">
            <span id="tishi"></span>
        </div>

        <button type="submit"  class="btn btn-success" id="submit">确认修改</button>
        <input type="reset" value="重置"/>
    </form>
    <form name="form2" action="/HTML/home">
        <button type="submit" class="btn btn-info">返回主页</button>
    </form>
    <p style="margin:0px">&nbsp;</p>
</center>


<!--<form action="/HTML/updatePasswordTo" method="post">-->
<!--<table>-->
<!--<tr><td>密码:</td><td><input type="text" name="password" size="20" /></td></tr>-->
<!--<tr><td>新密码:</td><td><input type="password" name="newPassword" id ="pwd1" size="20" /></td></tr>-->
<!--<tr><td>确认密码:</td><td><input type="password"name="passwordD" id ="pwd2" size="20"-->
<!--onkeyup="validate()"/><span id="tishi"></span></td><tr>-->
<!--<tr><td><input type="submit" value="确认修改" id ="submit"/><td>-->
<!--<input type="reset" value="重置"/><td>-->
<!--</table>-->
<!--</form>-->
<form name =form1 method="post" action="/HTML/userInfoUpdate">
    <a href="javascript:document.form1.submit();"><input name="按钮" type="button" value="返回"/>
    </a>
</form>
</body>
<script>
    function validate() {
        var pwd1 = document.getElementById("pwd1").value;
        var pwd2 = document.getElementById("pwd2").value;
        <!-- 对比两次输入的密码 -->
        if(pwd1 == pwd2) {
            document.getElementById("tishi").innerHTML="<font color='green'>两次密码相同</font>";
            document.getElementById("submit").disabled = false;
        }
        else {
            document.getElementById("tishi").innerHTML="<font color='red'>两次密码不相同</font>";
            document.getElementById("submit").disabled = true;
        }
    }
</script>
</html>